package edu.sctu.zhengsenwen.month201506.day20150607;

/**
 * Created by user15 on 2015/6/7.
 */
public class ThreadUtil extends Thread {

    @Override
    public void run() {

        int day = 0;
        int hour = 0;
        int minutes = 0;

        super.run();

        int time = 0;

        for (int i = 0; i < 100; i++) {

            time++;

            try {

                Thread.sleep(50);

            } catch (InterruptedException e) {

                e.printStackTrace();
            }

            if (time == 60) {

                minutes++;

                time = 0;
            }

            if (minutes == 60) {
                hour++;

                minutes = 0;
            }

            if (hour == 24) {

                day++;

                hour = 0;
            }

            System.out.println(day + "天 " + hour + "时 " + minutes + "分 " + time + "秒 ");
        }
    }
}



